package com.chinawayltd.ews.sample.service.impl;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chinawayltd.ews.sample.mapper.DeleteDataMapper;
import com.chinawayltd.ews.sample.service.SynchroDeleteDataService;

/**
 * @program: greeProject.timingTaskCenter
 * @description:
 * @author: xiazj
 * @create: 2018-05-25 13:22
 **/
@Service
public class SynchroDeleteDataServiceImpl implements SynchroDeleteDataService {

    private final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
    @Autowired
    private DeleteDataMapper deleteDataMapper;
	@Override
	public void synchroDeleteData() throws Exception {
		LocalDate now = LocalDate.now();
		now = now.minusMonths(1);
		String dateTime = formatter.format(now);
		deleteDataMapper.deleteInterfaceParamData(dateTime);
		now = now.minusMonths(2);
		dateTime = formatter.format(now);
		deleteDataMapper.deleteLogData(dateTime);
		deleteDataMapper.deleteInterfaceLogData(dateTime);
	}
    

}
